#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int n,a[maxn],b[maxn];
int x,p=2;
int cnt;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x;
        a[x]++;
        b[x]++;
    }
    for(int i=1;i<=maxn;i++){
        while(a[i]){
            p=max(p,i+1);
            x=min(a[i],b[p]);
            a[i]-=x;
            b[p]-=x;
            p++;
            cnt+=x;
         //   if(x)
        //cout<<p<<' '<<i<<' '<<x<<endl;
            if(p>maxn){
                cout<<n-cnt;
                cout<<endl;
                return 0;
            }
        }
    }
    return 0;
}
